<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ include file="/common/taglibs.jsp"%>
<x:parse xml="${param.xmlstr}" var="xmlData" />
<c:set var="grant_code"><x:out select="$xmlData/data/proposal/grant_code" /></c:set>
<c:set var="sub_grant_code"><x:out select="$xmlData/data/proposal/sub_grant_code" /></c:set>



<div class="t_bar"><span class="color_red">*</span>项目资金预算总表（单位：万元）</div>

<table class="t_css" width="100%" border="0" cellpadding="0" cellspacing="1" id="fungys">
	<col width="30%"  />
	<col width="14%"  />
	<col width="14%"  />
	<col width="14%"  />
	<col width="14%"  />
	<col width="14%"  />

	<tr>
		<td align="center" width="240" rowspan="2">资金来源</td>
		<td class="TblHead" align="center" rowspan="2">投资金额</td>
<!-- 		<td class="TblHead" align="center" rowspan="2">其中：已完成投资</td> -->
	
		<td class="TblHead" align="center" colspan="4">年度投资预算</td>
	</tr>
	<tr >
	
		<td class="TblHead" align="center" width="60" >${year}年</td>
		<td class="TblHead" align="center" width="60" >${year+1}年</td>
		<td class="TblHead" align="center" width="60" >${year+2}年</td>
		<td class="TblHead" align="center" width="60" >${year+3}年</td>
	
	</tr>
	<tr align="center">
		<td align="left" style="padding-left: 20px">合计</td>
		<td>
			<input type="text" name="budget/invest_detail/invest00/total_invest"
			id="total_invest_0" class="gray" disabled
			style="text-align: right; width: 50px;" label="资金来源-->投资金额-->合计"
			value="<x:out select="$xmlData/data/budget/invest_detail/invest00/total_invest" />" />
		</td>
		

		<td><input type="text" style="text-align: right; width: 50px;"
			name="budget/invest_detail/invest00/invest_yearp0" id="invest_yearp0_0"
			class="gray" disabled
			value="<x:out select="$xmlData/data/budget/invest_detail/invest00/invest_yearp0" />"
			onfocus="InitInput.setNumber(this,9,2,2)" /></td>
		<td><input type="text" style="text-align: right; width: 50px;"
			name="budget/invest_detail/invest00/invest_yearp1" id="invest_yearp1_0"
			class="gray" disabled
			value="<x:out select="$xmlData/data/budget/invest_detail/invest00/invest_yearp1" />"
			onfocus="InitInput.setNumber(this,9,2,2)" /></td>
		<td>
			<input type="text" style="text-align: right; width: 50px;"
			name="budget/invest_detail/invest00/invest_yearp2"
			id="invest_yearp2_0" class="gray" disabled
			value="<x:out select="$xmlData/data/budget/invest_detail/invest00/invest_yearp2" />"
			onfocus="InitInput.setNumber(this,9,2,2)" />
		</td>
		<td>
			<input type="text" style="text-align: right; width: 50px;"
			name="budget/invest_detail/invest00/invest_yearp3"
			id="invest_yearp3_0" class="gray" disabled
			value="<x:out select="$xmlData/data/budget/invest_detail/invest00/invest_yearp3" />"
			onfocus="InitInput.setNumber(this,9,2,2)" />
		</td>
		
	</tr>
	
	<tr align="center">
		<td align="left"><strong>申请财政专项资助</strong></td>
		<td> <input type="text"
			name="budget/invest_detail/invest02/total_invest" id="total_invest_2"
			label="资金来源-->申请财政专项资助-->投资金额" style="text-align: right; width: 50px;"
			class=""
			value="<x:out select="$xmlData/data/budget/invest_detail/invest02/total_invest" />"
			onchange="countFundAuto('total_','invest_2,invest_18,invest_3,invest_4,invest_5,invest_6','invest_0');" 
			onfocus="InitInput.setNumber(this,9,2,2)"/>
		</td>
		
		
		<td><input type="text" style="text-align: right; width: 50px;"
			name="budget/invest_detail/invest02/invest_yearp0" id="invest_yearp0_2"
			label="资金来源-->申请财政专项资助-->${year }年支出预算"
			value="<x:out select="$xmlData/data/budget/invest_detail/invest02/invest_yearp0" />"
			onfocus="InitInput.setNumber(this,9,2,2)"
			onchange="countFundAuto('','invest_yearp0_2,invest_yearp0_18,invest_yearp0_3,invest_yearp0_4,invest_yearp0_5,invest_yearp0_6','invest_yearp0_0');" />
		</td>
		<td><input type="text" style="text-align: right; width: 50px;"
			name="budget/invest_detail/invest02/invest_yearp1" id="invest_yearp1_2"
			label="资金来源-->申请财政专项资助-->${year+1}年支出预算"
			value="<x:out select="$xmlData/data/budget/invest_detail/invest02/invest_yearp1" />"
			onfocus="InitInput.setNumber(this,9,2,2)"
			onchange="countFundAuto('invest_','yearp1_2,yearp1_18,yearp1_3,yearp1_4,yearp1_5,yearp1_6','yearp1_0');" />
		</td>
		<td>
			<input type="text" style="text-align: right; width: 50px;"
			name="budget/invest_detail/invest02/invest_yearp2"
			id="invest_yearp2_2" label="资金来源-->申请财政专项资助-->${year+2}年支出预算"
			value="<x:out select="$xmlData/data/budget/invest_detail/invest02/invest_yearp2" />"
			onfocus="InitInput.setNumber(this,9,2,2)"
			onchange="countFundAuto('invest_','yearp2_2,yearp2_18,yearp2_3,yearp2_4,yearp2_5,yearp2_6','yearp2_0');" />
		</td>
		<td>
			<input type="text" style="text-align: right; width: 50px;"
			name="budget/invest_detail/invest02/invest_yearp3"
			id="invest_yearp3_2" label="资金来源-->申请财政专项资助-->${year+3}年支出预算"
			value="<x:out select="$xmlData/data/budget/invest_detail/invest02/invest_yearp3" />"
			onfocus="InitInput.setNumber(this,9,2,2)"
			onchange="countFundAuto('invest_','yearp3_2,yearp3_18,yearp3_3,yearp3_4,yearp3_5,yearp3_6','yearp3_0');" />
		</td>
		
	</tr>
	<tr align="center">
		<td align="left">牵头单位投入</td>
		<td><input type="text"
			name="budget/invest_detail/invest18/total_invest" id="total_invest_18"
			label="资金来源-->牵头单位投入-->投资金额" style="text-align: right; width: 50px;"
	
			value="<x:out select="$xmlData/data/budget/invest_detail/invest18/total_invest" />"
			onchange="countFundAuto('total_','invest_2,invest_18,invest_3,invest_4,invest_5,invest_6','invest_0');" 
			onfocus="InitInput.setNumber(this,9,2,2)"/>
		</td>
		
		
		<td><input type="text" style="text-align: right; width: 50px;"
			name="budget/invest_detail/invest18/invest_yearp0" id="invest_yearp0_18"
			label="资金来源-->牵头单位投入-->${year }年支出预算"
			value="<x:out select="$xmlData/data/budget/invest_detail/invest18/invest_yearp0" />"
			onfocus="InitInput.setNumber(this,9,2,2)"
			onchange="countFundAuto('','invest_yearp0_2,invest_yearp0_18,invest_yearp0_3,invest_yearp0_4,invest_yearp0_5,invest_yearp0_6','invest_yearp0_0');" />
		</td>
		<td><input type="text" style="text-align: right; width: 50px;"
			name="budget/invest_detail/invest18/invest_yearp1" id="invest_yearp1_18"
			label="资金来源-->牵头单位投入-->${year+1}年支出预算"
			value="<x:out select="$xmlData/data/budget/invest_detail/invest18/invest_yearp1" />"
			onfocus="InitInput.setNumber(this,9,2,2)"
			onchange="countFundAuto('invest_','yearp1_2,yearp1_18,yearp1_3,yearp1_4,yearp1_5,yearp1_6','yearp1_0');" />
		</td>
		<td>
			<input type="text" style="text-align: right; width: 50px;"
			name="budget/invest_detail/invest18/invest_yearp2"
			id="invest_yearp2_18" label="资金来源-->牵头单位投入-->${year+2}年支出预算"
			value="<x:out select="$xmlData/data/budget/invest_detail/invest18/invest_yearp2" />"
			onfocus="InitInput.setNumber(this,9,2,2)"
			onchange="countFundAuto('invest_','yearp2_2,yearp2_18,yearp2_3,yearp2_4,yearp2_5,yearp2_6','yearp2_0');"/>
		</td>
		<td>
			<input type="text" style="text-align: right; width: 50px;"
			name="budget/invest_detail/invest18/invest_yearp3"
			id="invest_yearp3_18" label="资金来源-->牵头单位投入-->${year+3}年支出预算"
			value="<x:out select="$xmlData/data/budget/invest_detail/invest18/invest_yearp3" />"
			onfocus="InitInput.setNumber(this,9,2,2)"
			onchange="countFundAuto('invest_','yearp3_2,yearp3_18,yearp3_3,yearp3_4,yearp3_5,yearp3_6','yearp3_0');"/>
		</td>
		
	</tr>
	<tr align="center">
		<td align="left">其他承担单位投入</td>
		<td>
		
			<input type="text" name="budget/invest_detail/invest03/total_invest" label="资金来源-->其他承担单位投入-->投资金额"
			style="text-align: right; width: 50px;" id="total_invest_3" 
			class=""
			onfocus="InitInput.setNumber(this,9,2,2)"
			onchange="countFundAuto('total_','invest_2,invest_18,invest_3,invest_4,invest_5,invest_6','invest_0');" 
			value="<x:out select="$xmlData/data/budget/invest_detail/invest03/total_invest" />" />
		</td>
		
			
		<td><input type="text" style="text-align: right; width: 50px;" name="budget/invest_detail/invest03/invest_yearp0"
			label="资金来源-->其他承担单位投入-->${year }年支出预算" id="invest_yearp0_3"  
			onfocus="InitInput.setNumber(this,9,2,2)"
			value="<x:out select="$xmlData/data/budget/invest_detail/invest03/invest_yearp0" />"
			onchange="countFundAuto('','invest_yearp0_2,invest_yearp0_18,invest_yearp0_3,invest_yearp0_4,invest_yearp0_5,invest_yearp0_6','invest_yearp0_0');" />
		</td>
		
		<td><input type="text" style="text-align: right; width: 50px;" name="budget/invest_detail/invest03/invest_yearp1"
			label="资金来源-->其他承担单位投入-->${year+1}年支出预算" id="invest_yearp1_3"  class=""
			onchange="countFundAuto('invest_','yearp1_2,yearp1_18,yearp1_3,yearp1_4,yearp1_5,yearp1_6','yearp1_0');"
			onfocus="InitInput.setNumber(this,9,2,2)"
			value="<x:out select="$xmlData/data/budget/invest_detail/invest03/invest_yearp1" />" />
			
		</td>
		
		<td><input type="text" style="text-align: right; width: 50px;" name="budget/invest_detail/invest03/invest_yearp2"
			label="资金来源-->其他承担单位投入-->${year+2}年支出预算" id="invest_yearp2_3"  class=""
			onchange="countFundAuto('invest_','yearp2_2,yearp2_18,yearp2_3,yearp2_4,yearp2_5,yearp2_6','yearp2_0');"
			onfocus="InitInput.setNumber(this,9,2,2)"
			value="<x:out select="$xmlData/data/budget/invest_detail/invest03/invest_yearp2" />" />
		</td>
		
		<td><input type="text" style="text-align: right; width: 50px;" name="budget/invest_detail/invest03/invest_yearp3"
			label="资金来源-->其他承担单位投入-->${year+3}年支出预算" id="invest_yearp3_3"  class=""
			onfocus="InitInput.setNumber(this,9,2,2)"
			value="<x:out select="$xmlData/data/budget/invest_detail/invest03/invest_yearp3" />" 
			onchange="countFundAuto('invest_','yearp3_2,yearp3_18,yearp3_3,yearp3_4,yearp3_5,yearp3_6','yearp3_0');"/>
		</td>
		
	
	</tr>
	<tr align="center">
		<td align="left">上级单位投入</td>
		<td>
			<input type="text"
			name="budget/invest_detail/invest04/total_invest"
			onchange="countFundAuto('total_','invest_2,invest_18,invest_3,invest_4,invest_5,invest_6','invest_0');" 
			label="资金来源-->上级单位投入-->投资金额" style="text-align: right; width: 50px;"
			id="total_invest_4" onfocus="InitInput.setNumber(this,9,2,2)"
			
			value="<x:out select="$xmlData/data/budget/invest_detail/invest04/total_invest" />" />
		</td>
	
			
		<td><input type="text" style="text-align: right; width: 50px;"
			name="budget/invest_detail/invest04/invest_yearp0"
			label="资金来源-->上级单位投入-->${year }年支出预算" id="invest_yearp0_4"
			value="<x:out select="$xmlData/data/budget/invest_detail/invest04/invest_yearp0" />"
			onfocus="InitInput.setNumber(this,9,2,2)"
			onchange="countFundAuto('','invest_yearp0_2,invest_yearp0_18,invest_yearp0_3,invest_yearp0_4,invest_yearp0_5,invest_yearp0_6','invest_yearp0_0');"  />
		</td>
		
		<td><input type="text" style="text-align: right; width: 50px;"
			name="budget/invest_detail/invest04/invest_yearp1"
			label="资金来源-->上级单位投入-->${year+1}年支出预算" id="invest_yearp1_4"
			value="<x:out select="$xmlData/data/budget/invest_detail/invest04/invest_yearp1" />"
			onfocus="InitInput.setNumber(this,9,2,2)"
			onchange="countFundAuto('invest_','yearp1_2,yearp1_18,yearp1_3,yearp1_4,yearp1_5,yearp1_6','yearp1_0');"/>
		</td>
		
		<td>
			<input type="text" style="text-align: right; width: 50px;"
			name="budget/invest_detail/invest04/invest_yearp2"
			label="资金来源-->上级单位投入-->${year+2}年支出预算" id="invest_yearp2_4"
			value="<x:out select="$xmlData/data/budget/invest_detail/invest04/invest_yearp2" />"
			onfocus="InitInput.setNumber(this,9,2,2)"
			onchange="countFundAuto('invest_','yearp2_2,yearp2_18,yearp2_3,yearp2_4,yearp2_5,yearp2_6','yearp2_0');"/>
		</td>
		
		<td>
			<input type="text" style="text-align: right; width: 50px;"
			name="budget/invest_detail/invest04/invest_yearp3"
			label="资金来源-->上级单位投入-->${year+3}年支出预算" id="invest_yearp3_4"
			value="<x:out select="$xmlData/data/budget/invest_detail/invest04/invest_yearp3" />"
			onfocus="InitInput.setNumber(this,9,2,2)"
			onchange="countFundAuto('invest_','yearp3_2,yearp3_18,yearp3_3,yearp3_4,yearp3_5,yearp3_6','yearp3_0');"/>
		</td>
		
		
	</tr>
	<tr align="center">
		<td align="left" >银行贷款</td>
		<td><input type="text"
			onchange="countFundAuto('total_','invest_2,invest_18,invest_3,invest_4,invest_5,invest_6','invest_0');" 
			name="budget/invest_detail/invest05/total_invest" id="total_invest_5"
			label="资金来源-->银行贷款-->投资金额" onfocus="InitInput.setNumber(this,9,2,2)"
			style="text-align: right; width: 50px;"
			onchange="countFundAuto('total_','invest_2,invest_18,invest_3,invest_4,invest_5,invest_6','invest_0');" 
			value="<x:out select="$xmlData/data/budget/invest_detail/invest05/total_invest" />" />
		</td>
		

		<td><input type="text" style="text-align: right; width: 50px;"
			id="invest_yearp0_5" name="budget/invest_detail/invest05/invest_yearp0"
			label="资金来源-->银行贷款-->${year }年支出预算"
			value="<x:out select="$xmlData/data/budget/invest_detail/invest05/invest_yearp0" />"
			onfocus="InitInput.setNumber(this,9,2,2)"
			onchange="countFundAuto('','invest_yearp0_2,invest_yearp0_18,invest_yearp0_3,invest_yearp0_4,invest_yearp0_5,invest_yearp0_6','invest_yearp0_0');" />
		</td>
		<td><input type="text" style="text-align: right; width: 50px;"
			id="invest_yearp1_5" name="budget/invest_detail/invest05/invest_yearp1"
			label="资金来源-->银行贷款-->${year+1}年支出预算"
			value="<x:out select="$xmlData/data/budget/invest_detail/invest05/invest_yearp1" />"
			onfocus="InitInput.setNumber(this,9,2,2)"
			onchange="countFundAuto('invest_','yearp1_2,yearp1_18,yearp1_3,yearp1_4,yearp1_5,yearp1_6','yearp1_0');"/>
		</td>
		<td>
			<input type="text" style="text-align: right; width: 50px;"
			id="invest_yearp2_5"
			name="budget/invest_detail/invest05/invest_yearp2"
			label="资金来源-->银行贷款-->${year+2}年支出预算"
			value="<x:out select="$xmlData/data/budget/invest_detail/invest05/invest_yearp2" />"
			onfocus="InitInput.setNumber(this,9,2,2)"
			onchange="countFundAuto('invest_','yearp2_2,yearp2_18,yearp2_3,yearp2_4,yearp2_5,yearp2_6','yearp2_0');"/>
		</td>
		<td>
			<input type="text" style="text-align: right; width: 50px;"
			id="invest_yearp3_5"
			name="budget/invest_detail/invest05/invest_yearp3"
			label="资金来源-->银行贷款-->${year+3}年支出预算"
			value="<x:out select="$xmlData/data/budget/invest_detail/invest05/invest_yearp3" />"
			onfocus="InitInput.setNumber(this,9,2,2)"
			onchange="countFundAuto('invest_','yearp3_2,yearp3_18,yearp3_3,yearp3_4,yearp3_5,yearp3_6','yearp3_0');"/>
		</td>
		
	</tr>
	<tr align="center">
		<td align="left">其他渠道</td>
		<td> <input type="text"
			name="budget/invest_detail/invest06/total_invest" id="total_invest_6"
			label="资金来源-->其他渠道-->投资金额"
			onchange="countFundAuto('total_','invest_2,invest_18,invest_3,invest_4,invest_5,invest_6','invest_0');" 
			style="text-align: right; width: 50px;"
			onfocus="InitInput.setNumber(this,9,2,2)"
			value="<x:out select="$xmlData/data/budget/invest_detail/invest06/total_invest" />" />
		</td>
		

		<td><input type="text" style="text-align: right; width: 50px;"
			id="invest_yearp0_6" name="budget/invest_detail/invest06/invest_yearp0"
			label="资金来源-->其他渠道-->${year }年支出预算"
			value="<x:out select="$xmlData/data/budget/invest_detail/invest06/invest_yearp0" />"
			onfocus="InitInput.setNumber(this,9,2,2)"
			onchange="countFundAuto('','invest_yearp0_2,invest_yearp0_18,invest_yearp0_3,invest_yearp0_4,invest_yearp0_5,invest_yearp0_6','invest_yearp0_0');" />
		</td>
		<td><input type="text" style="text-align: right; width: 50px;"
			id="invest_yearp1_6" name="budget/invest_detail/invest06/invest_yearp1"
			label="资金来源-->其他渠道-->${year+1}年支出预算"
			value="<x:out select="$xmlData/data/budget/invest_detail/invest06/invest_yearp1" />"
			onfocus="InitInput.setNumber(this,9,2,2)"
			onchange="countFundAuto('invest_','yearp1_2,yearp1_18,yearp1_3,yearp1_4,yearp1_5,yearp1_6','yearp1_0');"/>
		</td>

		<td>
			<input type="text" style="text-align: right; width: 50px;"
			id="invest_yearp2_6"
			name="budget/invest_detail/invest06/invest_yearp2"
			label="资金来源-->其他渠道-->${year+2}年支出预算"
			value="<x:out select="$xmlData/data/budget/invest_detail/invest06/invest_yearp2" />"
			onfocus="InitInput.setNumber(this,9,2,2)"
			onchange="countFundAuto('invest_','yearp2_2,yearp2_18,yearp2_3,yearp2_4,yearp2_5,yearp2_6','yearp2_0');" />
		</td>
		
		<td>
			<input type="text" style="text-align: right; width: 50px;"
			id="invest_yearp3_6"
			name="budget/invest_detail/invest06/invest_yearp3"
			label="资金来源-->其他渠道-->${year+3}年支出预算"
			value="<x:out select="$xmlData/data/budget/invest_detail/invest06/invest_yearp3" />"
			onfocus="InitInput.setNumber(this,9,2,2)"
			onchange="countFundAuto('invest_','yearp3_2,yearp3_18,yearp3_3,yearp3_4,yearp3_5,yearp3_6','yearp3_0');"/>
		</td>
		
	</tr>
	
	
</table>
　
<script type="text/javascript">
//初始化金额为0.0
$(document).ready(function() {
	var prp_version=$("#prp_version").text();
	if(prp_version==""||prp_version==null){
		$("#fundAdds").find(":input[type!=hidden][id^=total_invest]").each(function(){
			$(this).val("0.00");
		});
		$("#fundAdds").find(":input[type!=hidden][id^=total_invest_newly]").each(function(){
			$(this).val("0.00");	
		});
		$("#fundAdds").find(":input[type!=hidden][id^=apply_total]").each(function(){
			$(this).val("0.00");	
		});
		$("#fundAdds").find(":input[type!=hidden][id^=invest_yearp0]").each(function(){
			$(this).val("0.00");	
		});
		$("#fundAdds").find(":input[type!=hidden][id^=invest_yearp1]").each(function(){
			$(this).val("0.00");	
		});	
		$("#fundAdds").find(":input[type!=hidden][id^=invest_yearp2]").each(function(){
			$(this).val("0.00");
		});
		$("#fundAdds").find(":input[type!=hidden][id^=invest_yearp3]").each(function(){
			$(this).val("0.00");
		});
		$("#fundAdds").find(":input[type!=hidden][id^=invest_yearp4]").each(function(){
			$(this).val("0.00");
		});
	}

	//移除已完成的相等验证
	$("#source_already").removeClass("valueEqual:source_already:total_invest_finish_0");
});

//直接研发费用任意单项小于关系
$(document).ready(function() {
	$("#fundAdds").find(":input[type!=hidden]").each(function(){
		var id=$(this).attr("id");
		var numCount = 2;	//invest_code位数，默认1位
		var name = "";	//节点名
		if(!id)return true;
		//1.获取invest_code
		var num = id.substring(id.length-2, id.length);
		//2.判断invest_code 位数
		if(!$.isNumeric(num)) {
			numCount = 1;
			num = id.substring(id.length-1, id.length);
		}
		//3.获取节点名
		name = id.substring(0,id.length-numCount);
		if(parseInt(num) > 4 && parseInt(num) < 13) {
			//valueGreatEqual:total_invest_14:total_invest_newly_14
			//4.生成比较class并添加
			var classStr = "  valueGreatEqual:"+name+"4:"+id;
			$(this).addClass(classStr);
		}
	});
});
</script>


